﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using AsyncCamera.Camera.Structure;
using AsyncCamera.Camera.Pelco;
using Incendios0_1.Camera.media.pipelines;
using Incendios0_1.Camera.media.pipelines.cameras;
using AsyncCamera.Camera.media;

namespace Incendios0_1.Camera.wpfdatamanager
{
    class CameraFactory
    {

        public static AbstractCamera CreateCamera(CameraData cameraData)
        {
            cameraData.ErrorMessage = null;
            cameraData.Active = false;
            AbstractCamera pc;
            MediaGroup mediaFeed;
            switch (cameraData.Type)
            {
                case ((int) CameraType.Pelco):
                    pc = new PelcoCamera(cameraData);
                    mediaFeed = new FireFilterOutput(pc);
                    pc.media = mediaFeed;
                    mediaFeed.FPS = 10;
                    pc.Reset();
                    return pc;
                case ((int)CameraType.File):
                    pc = new FileCamera(cameraData);
                    mediaFeed = new FireFilterOutput(pc);
                    pc.media = mediaFeed;
                    mediaFeed.FPS = 30;
                    pc.Reset();
                    return pc;
                case ((int)CameraType.WebCam):
                    pc = new WebcamCamera(cameraData);
                    mediaFeed = new SimpleWebCamDisplay(pc);
                    pc.media = mediaFeed;
                    mediaFeed.FPS = 30;
                    pc.Reset();
                    return pc;
            }
            return null;
        }
    }
}
